/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package javaapplication13;

/**
 *
 * @author Irina
 */
public class Move implements ICommandExecutor 
{
    private static ICommandExecutor instance;
    
    @Override
    public void execute(String InputString)
    {
        String[] strOut=InputString.split(" ");
        if(strOut.length<3)
        {
            System.out.println("Не корректный формат команды.Повторите попытку.");
        }else
        {
            String strForCopy=InputString.replace("move", "copy");
            String strForDelete="delete "+strOut[1];
            Controller cnt=new Controller();
            cnt.executeCommand(strForCopy);
            cnt.executeCommand(strForDelete);
        }
    }
    
    public static ICommandExecutor getInstance()
    {
         if(instance==null)
        {
            instance=new Move();
        }
        return instance;
    }
}
